<title>发表空间说说 设置</title>
<div class="app-header t-v bg-bai dl2 bb b-hui"><span class="header-l t-v nowrap" onclick="x.mclose();"><i
        class="icon icon-pleft f9"></i>返回</span> <span class="header-c t-v t-c nowrap">发表空间说说 设置</span> <span
        class="header-r t-v t-r nowrap" onclick=""><i class="icon  f10"></i></span></div>
<div class="app-content bg-bai">
    <form role="form" id="qqsetgn" onsubmit="return false;"><input type="hidden" name="act" value="shuo"> <input
        type="hidden" name="qid" value="{$job.qid}"> <input type="hidden" name="id" value="{$job.uid}">
        <div class="p4">
            <div class="mb3 lan bold">[24H自动] 定时发表QQ空间说说</div>
            <hr/>
            <div class="pt4 pb4 bold">
                <label class="i-checks"><input type="radio" value="0"
                                                                                                 name="is"
                                                                                                 {if
                                                                                                 condition="$job.start eq 0"
                                                                                                 }
                                                                                                 checked=""
                                                                                                 {/if}
                                               ><i></i>关闭功能</label>
                <label class="i-checks ml4"><input type="radio" value="1"
                                                                                                 name="is"
                                                                                                 {if
                                                                                                 condition="$job.start eq 1"
                                                                                                 }
                                                                                                 checked=""
                                                                                                 {/if}
                                                   ><i></i>开启功能</label>
            </div>
            <hr/>
            <div class="pt3 pb4">
                <div class="rstxt mb3 t-v"><p class="w30 f4 bold">运行频率： <span class="hong"></span> 分钟</p>
                    <p class="mt0 f2 hui dl nobold">每隔设定的时间自动发表一篇说说</p></div>
                <input type="range" name="rate" min="1" max="1440" step="1"
                       {if
                                                                                                 condition="$job.rate eq ''"
                                                                                                 }
                                                                                                 value="600"
                                                                                                 {else}value="{$job.rate}"{/if}class="w b"></div>
            <hr/>
            <input type="hidden" name="xy" value="1">
            <div class="pt3 pb3 in-text">
                <dt class="bold bb pr2">说说内容</dt>
                <dd><select class="form w h8 bb" name="mode" onchange="selChange(this)">
					<option value="10" {if condition="$job.mode eq 10" } selected="selected" {/if}>网易云热评</option>
                	<option value="9" {if condition="$job.mode eq 9" } selected="selected" {/if}>漫画</option>
					<option value="8" {if condition="$job.mode eq 8" } selected="selected" {/if}>游戏</option>
					<option value="7" {if condition="$job.mode eq 7" } selected="selected" {/if}>动画</option>
					<option value="6" {if condition="$job.mode eq 6" } selected="selected" {/if}>原创</option>
					<option value="5" {if condition="$job.mode eq 5" } selected="selected" {/if}>小说</option>
					<option value="4" {if condition="$job.mode eq 4" } selected="selected" {/if}>网络</option>
					<option value="3" {if condition="$job.mode eq 3" } selected="selected" {/if}>其它</option>
					<option value="2" {if condition="$job.mode eq 2" } selected="selected" {/if}>随机</option>
					<option value="1" {if condition="$job.mode eq 1" } selected="selected" {/if}>自定义</option>
                </select></dd>
            </div>
            <div id="ned">
                <div id="ned2" style="display:none;">
                    <div class="pt2 pb3">
                        <div><font class="f4 bold">自定义内容</font><font class="ml4 f2 hui dl">多条内容可使用 | 号隔开，每次随机选择一条</font>
                        </div>
                        <div class="mt2"><textarea type="text" class="form w b" name="con" placeholder="输入你要发表的说说内容"
                                                   rows="3" autocomplete="off">{$job.data}</textarea></div>
                    </div>
                </div>
                <div class="pt1 pb3 in-text">
                    <dt class="bold bb pr2">说说图片</dt>
                    <dd><select class="form w h8 bb" name="tuid" onchange="selChanges(this)">
						<option value="3" {if condition="$job.tuid eq 3" } selected="selected" {/if}>不上传图片</option>
                        <option value="2" {if condition="$job.tuid eq 2" } selected="selected" {/if}>随机图片</option>
						<option value="1" {if condition="$job.tuid eq 1" } selected="selected" {/if}>自定义图片</option>
                    </select></dd>
                </div>
                <div id="ned3" style="display:none;">
                    <div class="pt1 pb3 in-text">
                        <dt class="bold bb pr2">图片地址</dt>
                        <dd><input type="url" class="form w h8 bb" name="url" id="upload" placeholder="点击上传或输入图片地址"
                                   onclick="mode_btn()"
                                   value="{$job.url}"
                                   autocomplete="off" readonly="readonly"></dd>
                    </div>
                </div>
            </div>
            <div class="pt1 pb3 in-text">
                <dt class="bold bb pr2">同时删除上一条说说</dt>
                <dd><select class="form w h8 bb" name="del">
                    <option value="0" {if condition="$job.del eq 0" } selected="selected" {/if}>0_否</option>
					<option value="1" {if condition="$job.del eq 1" } selected="selected" {/if}>1_是</option>
                </select></dd>
            </div>
            <input type="file" id="f" name="f" onchange="sc(this);" style="display:none"/>
            <div class="pt1 pb3">
                <button class="btn btn-qing btn-md w" onclick="ajax_gnset_shuo();">保 存 设 置</button>
            </div>
        </div>
</div>
</form>
<script>
    $(function () {
        $('input[type="range"]').rangeslider();
    });

    function mode_btn() {
        var htmlcon = '';
        htmlcon += '<li><a class="p3 lan bt b-hui footer in" onclick="f.click();x.mclose();">上传图片</a></li>';
        htmlcon += '<li><a class="p3 lan bt b-hui footer in" onclick="x.mclose();$(\'#upload\').attr({onclick:\'\',placeholder:\'请输入图片地址\',readonly:null})">输入地址</a></li>';
        x.footer(htmlcon);
    }

    function mode_btn2() {
        var htmlcon = '';
        htmlcon += '<li><a class="p3 lan bt b-hui footer in" onclick="f.click();x.mclose();">重新上传</a></li>';
        htmlcon += '<li><a class="p3 lan bt b-hui footer in" onclick="x.mclose();$(\'#upload\').attr({onclick:\'\',readonly:null})">修改地址</a></li>';
        x.footer(htmlcon);
    }

    function ajax_gnset_shuo() {
        var data = $("#qqsetgn").serialize();
        x.ajax('{:url('mobile_ajax/gnset',['act'=>'shuo'])}', data);
    }

    function selChange(o) {
        if (o.value == 1) {
            $("#ned").show();
            $("#ned2").show();
        } else {
            $("#ned").show();
            $("#ned2").hide();
        }
    }

    function selChanges(o) {
        if (o.value == 1) {
            $("#ned3").show();
        } else {
            $("#ned3").hide();
        }
    }


    if ('{$job.tuid}' == 1) {
        $("#ned3").show();
    }

    function sc() {
        var animateimg = $("#f").val(); //获取上传的图片名 带//
        var imgarr = animateimg.split('\\'); //分割
        var myimg = imgarr[imgarr.length - 1]; //去掉 // 获取图片名
        var houzui = myimg.lastIndexOf('.'); //获取 . 出现的位置
        var ext = myimg.substring(houzui, myimg.length).toUpperCase();  //切割 . 获取文件后缀
        var load = x.loading('上传图片中...');
        var file = $('#f').get(0).files[0]; //获取上传的文件
        var fileSize = file.size;           //获取上传的文件大小
        var maxSize = 1048576 * 5;              //最大1MB
        if (ext != '.PNG' && ext != '.GIF' && ext != '.JPG' && ext != '.JPEG' && ext != '.BMP') {
            parent.x.msg('文件类型错误,请上传图片类型');
            layer.close(load);
            return false;
        } else if (parseInt(fileSize) >= parseInt(maxSize)) {
            parent.x.msg('上传的文件不能超过5MB');
            layer.close(load);
            return false;
        } else {
            var data = new FormData($('#qqsetgn')[0]);
            $.ajax({
                url: "{:url('user_ajax/Gnset',['act'=>'upload'])}",
                type: 'POST',
                data: data,
                dataType: 'json',
                cache: false,
                processData: false,
                contentType: false,
                success: function (data) {
                    layer.close(load);
                if (data['isSuccess']) {
					x.msg('上传图片成功，保存设置后生效');
					$("#upload").val(''+data['f']+'');$("#upload").attr('onclick','mode_btn2()');
                } else {
                    x.msg('上传图片失败');
                }
                }
            });
        }
    }
</script>